package com.yangmf.auto_message_handle.mapper;

import com.yangmf.auto_message_handle.pojo.entity.User;
import com.yangmf.auto_message_handle.pojo.vo.CharacterVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {


    /**
     * TODO:根据openid查数据方法
     */
    @Select("select * from user where openid=#{openid}")
    public User selectUserByOpenid(String openid);


    /**
     * TODO:添加数据方法,需要获取返回主键值
     */
    public void insert(User user);
@Select("select * from user where id=#{id}")
    User selectById(Long id);


@Update("update user set avatar=#{url} where id=#{id}")

    void updateAvatar(String url, Long id);

    void updateUserInfo(User user);

    @Select("select seat_number,`character`,name from user")
    List<CharacterVO> getSeatList();

    @Update("update user set `character`=#{character} where seat_number=#{seatNumber}")
    void updateCharacter(Long character, String seatNumber);

    @Select("select * from user where name=#{name}")
    User selectUserByName(String name);
}


